package ThreadCommunicate;

import lombok.extern.slf4j.Slf4j;

import static java.lang.Thread.sleep;

@Slf4j(topic = "c.TestJoin")
public class TestJoin {
    static int i=0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            i = 10;
        });
        t1.start();
        Thread.sleep(50);
        t1.join();
        System.out.println(i);


        Thread  t2 = new Thread(() -> {
            System.out.println();
        });
        t2.start();
    }
}
